<template>
    <h2 align="center">显示房价计划</h2>
    <input type="button" value="导出" @click="Dout">
    <table border="1" align="center">
        <thead>
            <tr>
                <td><input type="checkbox"></td>
                <td>房价名称</td>
                <td>房量数量</td>
                <td>设置价格</td>
                <td>房型ID</td>
                <td>门店ID</td>
                <td>价格ID</td>
                <td>早餐数量</td>
                <td>人数数量</td>
                <td>开始时间</td>
                <td>结束时间</td>
                <td>操作</td>
            </tr>
        </thead>
        <tbody>
            <tr v-for="item in list">
                <td><input type="checkbox"></td>
                <td>{{item.roomPriceName  }}</td>
                <td>{{ item.roomPriceNum }}</td>
                <td>{{ item.price }}</td>
                <td>{{ item.roomTypeName }}</td>
                <td>{{ storelist.storeName }}</td>
                <td>{{ item.priceId }}</td>
                <td>{{ item.breakfast }}</td>
                <td>{{ item.people }}</td>
                <td>{{ item.sdate }}</td>
                <td>{{ item.edate }}</td>
                <td><input type="button" value="删除">
                    <input type="button" value="修改">
                </td>
            </tr>
        </tbody>
    </table>
</template>

<script setup lang="ts">
import {reactive,toRefs,onMounted} from 'vue';
import axios from 'axios';
import {useRouter,useRoute} from 'vue-router';
const router = useRouter()
const route = useRoute()
const data=reactive({
    state:{
    },
    list:[],
    storelist:[],
    arrIds:[],//存取选中的id
    flag:false//控制复选框是否被选中
})

const {state,storelist,list,arrIds,flag}=toRefs(data);

onMounted(()=>{
    getlist(),
    getstorelist()
})

const getstorelist=()=>{
    axios({
        url:'/api/Store/XianShi',
        method:'get',
        data:state.value
    })
    .then(res=>{
        console.log(res);
        storelist.value=res.data
    })
    .catch(err=>{
        console.log(err);
    })
}



const getlist=()=>{
    
    axios({
        url:'/api/Room/ShowTwo',
        method:'get',
        data:state.value
    })
    .then(res=>{
        console.log(res);
        list.value=res.data.data
    })
    .catch(err=>{
        console.log(err);
    })
}
//导出数据
const Dout=()=>{
    location.href=`https://localhost:7125/api/Room/DaoOutExcel`;
}
</script>